#!/usr/bin/node

const log=console.log,
      Dog=require('./02-dog.js');
let taidi=new Dog('taidi',4),
    zanao=new Dog('zangao',8);

taidi.on('bark',onBark);
zanao.on('bark',onBark);

function onBark(){
  log(`${this.name()} barked! energy:${this.energy()}`);
}
